<template>
    <div>
        <van-nav-bar
  title="标题"
  left-text="返回"
  left-arrow
  @click-left="onClickLeft"
  fixed
/><van-skeleton title :row="3" />
<div style="height: 45px;width: 370px;"></div>
<van-search
  v-model="valuess"
  shape="round"
  background="#4fc08d"
  placeholder="请输入搜索关键词"
/>
<div v-show="sou">
    <h4>历史记录</h4>
    <van-tag type="primary">标签</van-tag>
<van-tag type="success">标签</van-tag>
<van-tag type="danger">标签</van-tag>
<van-tag type="warning">标签</van-tag>
</div>
<div v-show="!sou">
    
    <van-cell-group v-for="item in qsearchApiData">
        <router-link :to="{name:'dd',params:{goods_id:item.goods_id}}">
  <van-cell :title="item.goods_name"/>
  </router-link>
</van-cell-group>
</div>
<van-empty description="描述文字" v-show="ko"/>
    </div>
</template>

<script setup>
import { ref,watch } from 'vue';
import { qsearchApi } from '@/api/api';
import _ from "lodash";
let valuess=ref('')
let qsearchApiData=ref([])
let sou=ref(true)
let ko=ref(false)
watch(valuess,(val)=>{
    if(val.length==0){
        sou.value=true
        ko.value=false
    }else{
        sou.value=false
        qsearchApi(val).then(res=>{
            qsearchApiData.value=res.data.message
            console.log(res);
            if(qsearchApiData.value.length==0){
                ko.value=true
            }else{
                ko.value=false
            }
        })
    }
})
const onClickLeft = () => history.back();
</script>

<style lang="scss" scoped>

</style>